import { useRoutes, Navigate } from 'react-router-dom'
import Login from '../views/Login'
import Home from '../views/Home/index'
import NormalUser from '../views/Home/NormalUser'
import TrafficUser from '../views/Home/TrafficUser'

const RouterView = () => {
  const routes = useRoutes([
    { path: '/', element: <Navigate to="/home" /> },
    {
      path: '/home',
      element: <Home />,
      children: [
        { path: '/home', element: <Navigate to="/home/normal" /> },
        { path: 'normal', element: <NormalUser /> },
        { path: 'traffic', element: <TrafficUser /> },
      ],
    },
  ])
  return routes
}

export default RouterView
